package com.hqd.ch03.test.web.v41;


import com.hqd.ch03.v41.context.stereotype.Controller;
import com.hqd.ch03.v41.web.bind.annotation.RequestMapping;
import com.hqd.ch03.v41.web.ui.Model;

@Controller
public class HelloController {
    // 首页视图
    @RequestMapping("/index")
    public String home(Model model) {
        // 将 Flash 属性添加到重定向的请求中
        model.addAttribute("message", "Form submitted successfully!");
        return "redirect:hello";
    }

    @RequestMapping("/hello")
    public String hello(String message, Model model) {
        model.addAttribute("message", message);
        return "hello";
    }
}
